import random
"""
p1='桃花流水鳜鱼肥'
p2='春江水暖鸭先知'
p3='秦时明月汉时关'
p4='万里长征人未还'
p5=random.randint(1,4)
if p5==1:
    print(p1)
    p5=p1
if p5==2:
    print(p2)
    p5=p2
if p5==3:
    print(p3)
    p5=p3
if p5==4:
    print(p4)
    p5=p4
a=input("?")
if a==p5:
    print("你是对的")
    print(p5)
else:
    print("你是错的")
    print(p5)

from random import*
s=['很久很久以前','之前','古代','上世纪','1年前','今天','明天','下世纪']
r1=['杰哥','阿伟','杨玉静','龙宇泽','付娆','许愿','王可晶','郑浩轩']
r2=['杰哥','阿伟','何玉明','鱼锦绣','江宇萌','承诺','你妈','SB']
r3=['杰哥','阿伟','你妈','SB','谢天','潘锦庆','余元','于子尧']
r4=['你妈','炸弹','唐若萱','曾文轩','猫','猫猫喵','马小跳',]
d1=['客厅','厕所','地砖','走道','操场','国旗下','游乐场','工地']
d2=['电脑室','教室','桌椅','角落','小卖部','超市','菜市场','你家']
s1=['相亲','搞鸡','玩狼人杀','玩保护你妈','玩你是SB','跳舞','下象棋','唱歌']
s2=['买菜','卖菜','搞鸡','玩保护你妈','玩你是SB','跳舞','搞蛋','做绝育']
g='故事发生在'+choice(s)+','+choice(r1)+'和'+choice(r2)+'在'+choice(d1)+choice(s1)+'.'+choice(r3)+'在'+choice(d2)+choice(s2)+'.'+choice(r4)+'在看'+choice(r2)+choice(s1)+'.'
print(g)
"""
"""
import pygame
import pygame.examples.aliens
import pygame.examples.stars
import pygame.examples.chimp
import pygame.examples.liquid
pygame.examples.liquid.main()

pygame.examples.aliens.main()
pygame.examples.oldalien.main()
import pygame.examples.scaletest
pygame.examples.scaletest.main()
pygame.examples.stars.main()
pygame.examples.chimp.main()

time_time=3
"""
import pygame.examples.aliens
pygame.examples.aliens.main()

import pygame as pg
import sys
from random import randint
import time
pg.init()


pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
pygame.examples.aliens.main()
print("1")
pygame.examples.aliens.main()


"""

game_window = pg.display.set_mode((600, 600))
pg.display.set_caption("接弹珠游戏")
score = 0
font = pg.font.Font(None, 60)
window_color = (0, 0, 0)  # 设置窗口颜色——黑色
ball_color = (0, 255, 0)  # 设置球的颜色-——绿色
rect_color = (255, 0, 0)  # 设置挡板颜色——红色
move_x = 1
move_y = 1
ball_x = randint(100, 580) #球的初始位置随机
ball_y = randint(100, 480)
points = 1
count = 0
a_a=True
while a_a==True:
    game_window.fill(window_color)
    for event in pg.event.get():
        if event.type == pg.QUIT:
            sys.exit()
    mouse_x, mouse_y = pg.mouse.get_pos()
    pg.draw.circle(game_window, ball_color, (ball_x, ball_y), 20)   #在窗口内画球
    pg.draw.rect(game_window, rect_color, (mouse_x,mouse_y, 2500, 1000))  #在窗口内画矩形接拍
    ball_x += move_x
    my_score = font.render(str(score), False, (255, 255, 0))    #设置分数显示，黄色
    game_window.blit(my_score, (1, 1))
    ball_x += move_x
    ball_y += move_y
    if ball_x <= 20 or ball_x >= 580:          #左右两侧墙壁
        move_x = -move_x                      #碰到左右两侧墙壁时，X坐标变为反方向
    if ball_y <= 20:                           #碰到上方墙壁时，Y坐标改变方向
        move_y = -move_y
    if ball_x >(mouse_x - 10000) and ball_x <(mouse_x + 2500)  and ball_y >= 570:
        move_y = -move_y                      #下方接到球，改变Y坐标方向，并加分
        score += points
        count += 1                            #接球次数加1
        if count == 5:
            count = 0
            points += points
            move_yy=move_y
            if move_x>0:
                move_x += 5
                move_y += 5
            if move_y>move_yy+5:
                move_y-=5
                move_x-=5
                a_a=False
                a=1+1                #分数翻倍                     #接球次数加1
    elif ball_y > 600 and (ball_x <= mouse_x - 20 or ball_x >= mouse_x + 120):
        ball_y = 490
        time.sleep(1)             #没有接到球，退出程序 
        a=0
        break
    if score>1000000000000000000000000000000:
        a_a=False
    pg.display.update()           #更新窗口，保证窗口始终打开
    time.sleep(0.001)           #球运动的速度0.03秒走一个像素
print(score)
"""